﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Create3P.ascx.vb" Inherits="Control_PrintLabel_Create3P" %>

 <script type="text/javascript" >
     function ajaxJquery() {
         $(function () {
             $(".TextBox:first").focus();
             $(".Date").datepicker({ dateFormat: 'dd/mm/yy' });
             $("#<%=txtItemCode.ClientID()%>").autocomplete({
                 source: function (request, response) {
                     $.ajax({
                         url: '<%=ResolveUrl("~/Services/wsAutoComplete.asmx/GetAutoCompleteVendorMSDS")%>',
                         data: "{ 'strSrc': '" + request.term.trim() + "'}",
                         dataType: "json",
                         type: "POST",
                         contentType: "application/json; charset=utf-8",
                         beforeSend: function () {
                         },
                         dataFilter: function (data) {
                             return data;
                         },
                         success: function (data) {
                             response($.map(data.d, function (item) {
                                 return {
                                     label: item.FullText, value: item.ID
                                 }
                             }))
                         },
                         error: function (XMLHttpRequest, textStatus, errorThrown) {
                             //Alertbox(textStatus);
                         },
                         complete: function () {
                         }
                     });
                 },
                 focus: function (event, ui) {
                     $(this).val(ui.item.value);
                     return false;
                 },
                 select: function (event, ui) {
                     var _itemCode = ui.item.value;
                     $(this).val(_itemCode);
                     $("#<%=txtItemName.ClientId() %>").val(ui.item.label);
                     setTimeout(FilterVendorCode(_itemCode), 1000);
                     return false;
                 },
                 minLength: 1
             });         
         });
         // focus textbox first
     


     }

     // Function set Vendor Code and vendorName
     function SetVendorCode(obj) {
         var _value = obj.options[obj.selectedIndex].value;
         var _text = obj.options[obj.selectedIndex].text.replace(_value + " - ", "");

         $("#<%=hidVendorCode.ClientId() %>").val(_value);
         $("#<%=txtVendorName.ClientId() %>").val(_text);


     }

     // function Ajax filter Vendor Code by ItemCode
     function FilterVendorCode(_itemCode) {
         $("#DivVendorCode").empty();
         $.ajax({
             url: '<%=ResolveUrl("~/Services/wsAutoComplete.asmx/GetListVendorMSDS")%>',
             data: "{ 'itemCode': '" + _itemCode + "'}",
             dataType: "json",
             type: "POST",
             contentType: "application/json; charset=utf-8",
             beforeSend: function () {

             },
             dataFilter: function (data) {
                 return data;
             },
             success: function (data) {
                 if (data.d != null) {
                     var _html = "<select class='DropDownList' onchange='SetVendorCode(this)'><option value=''> --- Chọn --- </option>";
                     $.each(data.d, function (idx, obj) {
                         _html += ("<option value='" + obj.ID + "'>" + obj.ID + " - " + obj.FullText + "</option>");
                     });
                     _html += "</select>";
                     $("#DivVendorCode").append(_html);                     
                 }
             },
             error: function (XMLHttpRequest, textStatus, errorThrown) {
                 //Alertbox(textStatus);
             },
             complete: function () {
             }
         });
         return true;
     }


     function writeSwf(swf) {
         open_window_max('Viewer.aspx?swf=' + swf, 'viewer');
     }

     function open_iframe(aURL, aWinName) {
         document.getElementById('expFile').src = aURL;
     }
        
     function open_window_max(aURL, aWinName) {
         var wOpen;
         var sOptions;

         sOptions = 'status=no,menubar=no,scrollbars=auto,resizable=no,toolbar=no,fullscreen=yes';
         sOptions = sOptions + ',width=' + (screen.availWidth - 0).toString();
         sOptions = sOptions + ',height=' + (screen.availHeight - 0).toString();
         sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

         wOpen = window.open('', aWinName, sOptions);
         wOpen.location = aURL;
         wOpen.focus();
         wOpen.moveTo(0, 0);
         wOpen.resizeTo(screen.availWidth, screen.availHeight);
         return wOpen;
     }
</script>

<asp:UpdatePanel ID="uplWarehouse" runat="server">
<ContentTemplate>
<div  class="BoxField">

    <div class="HeadTitle">
         <h3>
            <asp:Label ID="Label3" runat="server" Text="PRINT LABEL" /></h3>
     </div>
   <div class="DivRequired">
       <span class="fieldRequired">&nbsp;</span>Trường yêu cầu nhập dữ liệu
   </div>
   <div class="Error">
      <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="#FF3300" />
  </div>

	
		<div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="Label5" CssClass="TextLabel" runat="server" Text="Item Code:" />
                        <span class="fieldRequired">&nbsp;</span>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtItemCode"
                Display="None" ErrorMessage="Vui lòng nhập item Code" SetFocusOnError="True" />

		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtItemCode" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>

		<div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="Label7" CssClass="TextLabel" runat="server" Text="Item Name:" />
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtItemName" CssClass="TextBox" runat="server" Text="" />
		</div>

		</div>
		<div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="Label6" CssClass="TextLabel" runat="server" Text="Vendor Code:" />
            <span class="fieldRequired">&nbsp;</span>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="hidVendorCode"
                Display="None" ErrorMessage="Vui lòng chọn vendor" SetFocusOnError="True" />

		</div>
		<div  class="DivTextBox" id="DivVendorCode" >
			
		</div>
		</div>

		<div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="Label8" CssClass="TextLabel" runat="server" Text="Vendor Name:" />
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtVendorName" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>


        <div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="Label9" CssClass="TextLabel" runat="server" Text="MFG date (DD/MM/YYYY):"  />
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtNgaySanXuat" CssClass="TextBox Date" runat="server" Text="" MaxLength="10" />
		</div>
		</div>


        <div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="Label10" CssClass="TextLabel" runat="server" Text="EXP Date (DD/MM/YYYY):"  />
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtHanSuDung" CssClass="TextBox Date" runat="server" Text="" MaxLength="10" />
		</div>
		</div>

		<div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="lblKhoiluongthetich" CssClass="TextLabel" runat="server" Text="Package Size" />
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtPackageSize" CssClass="TextBox" runat="server" Text="" /> 
		</div>
		</div>

		<div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="lblQuycachdonggoi" CssClass="TextLabel" runat="server" Text="Base Unit of Measure:" />

		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtBUN" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>

		<div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="Label4" CssClass="TextLabel" runat="server" Text="Packing Type:" />
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtPackageType" CssClass="TextBox" runat="server" Text=""  />
		</div>

		<div class="DivRow">
		<div  class="DivLabel">
			<asp:Label ID="Label1" CssClass="TextLabel" runat="server" Text="Loại nhãn:" />
		</div>
		<div  class="DivTextBox" >
			<asp:DropDownList ID="ddlLabelType" runat="server" CssClass="DropDownList">
                <asp:ListItem Value="0" Text="Có viền"></asp:ListItem>
                <asp:ListItem Value="1" Text="Không có viền"></asp:ListItem>
            </asp:DropDownList>
		</div>



		<div class="DivRow" style="display:none">
		<div  class="DivLabel">
			<asp:Label ID="lblNumber" CssClass="TextLabel" runat="server" Text="Number of label:"  />
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtNumber" CssClass="TextBox" runat="server" Text="" MaxLength="10" />
		</div>
		</div>

		<div class="DivRow">
		<div class="DivLabel" >&nbsp;&nbsp;&nbsp;</div>
		<div class="DivTextBox" > 
			<asp:Button ID="btnSave" runat="server" Text=" Preview " CssClass="btn"  />
			
			
            &nbsp; <asp:Button ID="btnExportWord" runat="server"  CssClass="btn" Text="Export Word"  />
            &nbsp; <asp:Button ID="btnExportPdf" runat="server"  CssClass="btn" Text="Export PDF" />

            &nbsp;<asp:Button ID="btnReset" runat="server" CausesValidation="false" CssClass="btn" Text="Làm mới" />

		</div>
		</div>

</div>
<div style="display: none">
<asp:HiddenField ID="hidID" Value="0" runat="server" />
<asp:textbox ID="hidVendorCode" Text="" runat="server" />
<asp:HiddenField ID="hidBatchNo" Value="0" runat="server" />

<iframe src="#" id="expFile">
    
</iframe>
</div>

</ContentTemplate>
</asp:UpdatePanel>
